<template>
  <a-card style="width: 100%">
    <a-form :form="form">
      <a-row :gutter="48">
        <a-col :sm="{span:24}" :lg="{span:12}">
          <a-form-item
            label="审核时间"
            :labelCol="{span: 7,offset: 1}"
            :wrapperCol="{span: 15, offset: 1}"
          >
            <a-range-picker v-decorator="[
              'shsj',
              {
                rules: [{ required: true, message: '请选择审核时间!' }],
              }
            ]"/>
            <!-- <a-date-picker
              :disabledDate="disabledStartDate"
              showTime
              format="YYYY-MM-DD HH:mm:ss"
              v-decorator="[
                'pyjhshkssj',
                {
                  rules: [{ required: true, message: '请选择审核开始时间!' }],
                }
              ]"
              placeholder="请选择时间"
              @openChange="handleStartOpenChange"
            /> -->
          </a-form-item>
        </a-col>
        <!-- <a-col :sm="{span:24}" :lg="{span:12}">
          <a-form-item
            label="审核结束时间"
            :labelCol="{span: 7,offset: 1}"
            :wrapperCol="{span: 15, offset: 1}"
          >
            <a-date-picker
              :disabledDate="disabledEndDate"
              showTime
              format="YYYY-MM-DD HH:mm:ss"
              placeholder="请选择时间"
              v-decorator="[
                'pyjhshjssj',
                {
                  rules: [{ required: true, message: '请选择审核结束时间!' }],
                }
              ]"
              :open="endOpen"
              @openChange="handleEndOpenChange"
            />
          </a-form-item>
        </a-col> -->
        <a-col :sm="{span:24}" :lg="{span:12}"><a-button type="primary" @click="handleSave">保存</a-button></a-col>
      </a-row>
    </a-form>
  </a-card>
</template>
<script>
// import moment from 'moment'
import { mapState } from 'vuex'
import ACol from "ant-design-vue/es/grid/Col";

export default {
  name: 'Timeset',
  components: {ACol},
  data () {
    return {
    }
  },
  computed: {
    ...mapState({
      systemInfo: state => state.app.systemInfo
    })
  },
  beforeCreate () {
    this.form = this.$form.createForm(this)
  },
  created () {
    this.$store.dispatch('app/sysInfo', true).then(res => {
      this.$nextTick(() => {
        this.form.setFieldsValue({shsj: [res.pyjhshkssj, res.pyjhshjssj]})
      })
    })
  },
  methods: {
    // 保存操作
    handleSave () {
      this.form.validateFields((err, values) => {
        if (err) {
          return
        }
        let params = {pyjhshkssj: values.shsj[0].format('YYYY-MM-DD') + ' 00:00:00', pyjhshjssj: values.shsj[1].format('YYYY-MM-DD') + ' 23:59:59'}
        this.$api.cultivate.planCheckTimeset(params).then(res => {
          this.$message.success(res.msg)
        })
      })
    }
  }
}
</script>
